package tankgame02;

import javax.swing.*;

/**
 * TankGame02
 * 完善功能
 * 防止坦克重叠
 */
public class TankGame02 extends JFrame {
    //定义面板组件
    MyPanel mp = null;

    public static void main(String[] args) {
        TankGame02 tankGame02 = new TankGame02();
    }

    public TankGame02() {
        //初始化面板
        mp = new MyPanel();
        //将面版 mp 放入到Thread，并启动
        Thread thread = new Thread(mp);
        thread.start();
        //把面板放入到窗口中
        this.add(mp);
        this.setSize(1280, 1000);
        this.addKeyListener(mp);//让JFrame 监听mp的键盘事件
        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        this.setVisible(true);
    }

}
